(require :sb-cover)

;; enable coverage
(declaim (optimize sb-cover:store-coverage-data))

;; (require :asdf)

(defun src-file (file)
  (format nil "~a/src/~a" common-lisp-user:*project-home* file))

(let ((asdf:*central-registry* (cons (src-file "") asdf:*central-registry*)))
  (if nil
      (asdf:oos 'asdf:load-op :abtab :force t)
      (asdf:oos 'asdf:load-op :abtab)))

(defun compile-load-run (sfile)
  (compile-file (src-file sfile))
  (load (src-file sfile)))


(mapcar #'compile-load-run '("test-abtab" "test-delimieted-driver"))

(lisp-unit:run-all-tests :test-abtab)
(lisp-unit:run-all-tests :test-delimited-driver)

(format t "~&writing coverage report to => ~a~&" *report-directory*)
(sb-cover:report *report-directory*)
(format t "~&coverage report created => ~a~&" *report-directory*)

(declaim (optimize (sb-cover:store-coverage-data 0)))

(sb-ext:quit)
